import request from '@/utils/request'

export async function getCarRecord(data) {
  return request({
    url: '/collectCarImage/pageQuery',
    method: 'post',
    data,
  })
}

export async function doDeleteCarRecord(data) {
  return request({
    url: '/collectCarImage/pageQuery',
    method: 'post',
    data,
  })
}

export function doEdit(data) {
  return Promise.resolve(data)
}
// 获取人脸图片列表
export async function getFaceRecord(data) {
  return request({
    url: '/collectFaceImage/pageQuery',
    method: 'post',
    data,
  })
}
// 获取车辆列表
export async function getCarInfo(data) {
  return request({
    url: '/baseCar/pageQuery',
    method: 'post',
    data,
  })
}
// 获取设备列表
export async function getEquipments(data) {
  return request({
    url: '/baseDevice/pageQuery',
    method: 'post',
    data,
  })
}
// 修改设备状态
export function updateDeviceState(id, enable) {
  return request({
    url: `/baseDevice/enableDevice?id=${id}&enable=${enable}`,
    method: 'post',
    data: {},
  })
}
// 新增修改设备信息
export async function saveOrEditDeviceInfo(data) {
  return request({
    url: '/baseDevice/saveOrUpdate',
    method: 'post',
    data,
  })
}
// 删除设置信息
export function deleteDeviceById(id) {
  return request({
    url: '/baseDevice/deleteById?id=' + id,
    method: 'post',
    data: {},
  })
}
// 获取街道信息
export function getTownList() {
  return request({
    url: '/baseResident/getTownList',
    method: 'get',
  })
}
// 获取小区信息
export function getAreaList(townId) {
  return request({
    url: '/baseResident/getAreaList/' + townId,
    method: 'get',
  })
}
// 获取智慧门禁记录
export function getGuardList(data) {
  return request({
    url: '/collectEntryGuard/pageQuery',
    method: 'post',
    data,
  })
}
// 更新车辆信息
export function updateCarInfo(id, parkType, validDate) {
  return request({
    url: '/baseCar/updateWithoutNull',
    method: 'post',
    data: { id, parkType, validDate },
  })
}
// 同步车辆信息到一体机
export function uploadWhiteList(areaNo) {
  return request({
    url: '/baseCar/syncCarWhiteList',
    method: 'post',
    data: { areaNo },
  })
}
// 导出车辆数据到excel
export function exportCarList() {
  return request({
    url: '/baseCar/exportCar',
    method: 'post',
    data: {},
  })
}
// 导出设备导excel
export function exportDevice() {
  return request({
    url: '/baseDevice/exportDevice',
    method: 'post',
    data: {},
  })
}
// 启动设备
export function startDevice(deviceId) {
  return request({
    url: '/baseDevice/start?deviceId=' + deviceId,
    method: 'get',
  })
}
// 停止设备
export function stopDevice(deviceId) {
  return request({
    url: '/baseDevice/stop?deviceId=' + deviceId,
    method: 'get',
  })
}
